package deepbrain.simnetwork.structure;

import deepbrain.simnetwork.exception.SimNetworkException;

/**
 * A ConnectionMatrix is made up of 1s and 0s representing whether there is a
 * connection between the source and destination nodes.
 * 
 * @author Li Yang
 * @create 2009-2-23
 */
public class SimpleConnectionMatrix extends ConnectionMatrix<Boolean> {

	private static final long serialVersionUID = 2592898094257851146L;

	public SimpleConnectionMatrix() {
		super();
	}

	public SimpleConnectionMatrix(String parseLine) throws SimNetworkException {
		super(parseLine);
	}

	public SimpleConnectionMatrix(Boolean[][] matrix)
			throws SimNetworkException {
		super(matrix);
	}

	@Override
	public Boolean parseWeight(String weight) {
		return weight.equals("1") ? true : false;
	}

	@Override
	public String serializeWeight(Boolean weight) {
		if (weight==null)
			return "0";
		return weight ? "1" : "0";
	}
}
